package it.blueocean.acanto.platform.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class MainController
{
	private final static Logger logger = LoggerFactory.getLogger(MainController.class);
	
	@RequestMapping(method = RequestMethod.GET, value = "/index.htm")
	public String getIndexPage()
	{
		logger.info("invoked index.htm");
		return "home.htm";
	}
	
	@RequestMapping(method = RequestMethod.GET, value = "/home.htm")
	@Secured("ROLE_USER")
	public String getHomePage()
	{
		logger.info("invoked home.htm");
		return "secure/index";
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/home.htm")
	@Secured("ROLE_USER")
	public String getHomePagePost()
	{
		logger.info("invoked home.htm");
		return "secure/index";
	}
}
